<template>
  <div class="wrapper">
    <swiper :options="swiperOption" v-if="validSlideList">
      <!-- slides -->
      <swiper-slide v-for="item of slideList" :key="item.id">
        <img class="swiper-img" :src="item.uri" alt="">
      </swiper-slide>
      <!-- Optional controls -->
      <div class="swiper-pagination"  slot="pagination"></div>
    </swiper>
  </div>
</template>

<script>
  export default {
    name: "HomeSwiper",
    data() {
      return {
        swiperOption: {
          loop: true,
          pagination: ".swiper-pagination",
          autoplay: 2000
        },
        slideList: [
          {
            id: 1,
            uri: require("@/assets/images/1.png")
          },
          {
            id: 2,
            uri: require("@/assets/images/2.jpg")
          },
          {
            id: 3,
            uri: require("@/assets/images/3.jpg")
          }
        ]
      }
    },
    computed: {
      validSlideList() {
        return !!this.slideList;
      }
    }
  }
</script>

<style scoped>

  .wrapper >>> .swiper-pagination-bullet-active {
    background-color: #fff;
  }

  .swiper-img {
    width: 100%;
  }

  .wrapper {
    width: 100%;
    height: 0;
    padding-bottom: 43.2%;
    background-color: #eeeeee;
    overflow: hidden;
  }
</style>